//
//  TradeRecordCell.m
//  阿帕
//
//  Created by mac on 2020/1/2.
//  Copyright © 2020 GCY. All rights reserved.
//

#import "TradeRecordCell.h"

@interface TradeRecordCell ()
@property (weak, nonatomic) IBOutlet UILabel *textTypeLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *balanceLabel;
@property (weak, nonatomic) IBOutlet UILabel *incomeLabel;
@property (weak, nonatomic) IBOutlet UIView *lineView;

@end

@implementation TradeRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _textTypeLabel.textColor = Dark_TextColor;
    _dateLabel.textColor = Light_TextColor;
    _balanceLabel.textColor = Dark_TextColor;
    _lineView.backgroundColor = BackgroundColor;
}

- (void)setModel:(TradeRecordModel *)model {
    
    _model = model;
    
    _textTypeLabel.text = [StatusTextJudge paidItemJudge:model.paidItem];
    
    _dateLabel.text = model.gmtCreated;
    
    _balanceLabel.text = CJStringWithFormat(@"余额：%.2f", model.accountAmount);
    
//    paidFeeType (string, optional): 收入(0) or 支出(1)
    if ([model.paidFeeType isEqual:@"1"]) {
        //支出
        _incomeLabel.text = CJStringWithFormat(@"-%.2f", model.paidAmount);
        _incomeLabel.textColor = Orange_Color;
    } else {
        //收入
        _incomeLabel.text = CJStringWithFormat(@"+%.2f", model.paidAmount);
        _incomeLabel.textColor = Theme_ColorValue;
    }
}
- (void)setColltionModel:(CollationRecordModel *)colltionModel{
    
    _colltionModel = colltionModel;
    
    _textTypeLabel.text = [StatusTextJudge paidItemJudge:colltionModel.paidItem];
    
    _dateLabel.text = colltionModel.gmtCreated;
    
    _balanceLabel.text = CJStringWithFormat(@"余额：%.2f", colltionModel.accountAmount);
    
//    paidFeeType (string, optional): 收入(0) or 支出(1)
    if ([colltionModel.paidFeeType isEqual:@"1"]) {
        //支出
        _incomeLabel.text = CJStringWithFormat(@"-%.2f", colltionModel.sumpaidAmount);
        _incomeLabel.textColor = Orange_Color;
    } else {
        //收入
        _incomeLabel.text = CJStringWithFormat(@"+%.2f", colltionModel.sumpaidAmount);
        _incomeLabel.textColor = Theme_ColorValue;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
